The effect description, as explained in "Creating an Effect Description" , will form the sample that is added to the media of the effects track. Before you can add the sample, you must create a corresponding sample description, that is, a data structure that describes the sample being added.
It is important to distinguish between the effect description and the sample description. The effect description is a data structure that describes the effect to be used. The sample description is a data structure that describes a sample of a track's media. The sample description is needed when you add your effect description to an effect track.
To create a sample description, you create and fill out a data structure of type ImageDescription . The code shown in Listing 8 provides an example of how to do this.
Listing 8 Creating and filling out a sample description
sampleDesc = (ImageDescriptionHandle) NewHandleClear(sizeof(ImageDescription));
(**sampleDesc).idSize = sizeof(ImageDescription);
(**sampleDesc).cType = 'fmns';
(**sampleDesc).vendor = 'appl';
(**sampleDesc).temporalQuality = codecNormalQuality;
(**sampleDesc).spatialQuality = codecNormalQuality;
(**sampleDesc).width = 640;
(**sampleDesc).height = 480;
(**sampleDesc).hRes = 72L << 16;
(**sampleDesc).vRes = 72L << 16;
(**sampleDesc).frameCount = 1;
(**sampleDesc).depth = 24;
(**sampleDesc).clutID = -1;
The ImageDescription data structure is described in detail in Chapter 4, "Image Compressor Components."
The width , height , vRes , hRes , depth and clutID fields describes the spatial characteristics of the sample. In this example, the effect sample is 640x480 pixels, has a resolution of 72 dpi (the standard screen resolution), runs at 24-bits and does not have a color lookup table.
The spatialQuality and temporalQuality fields describe the quality of the effect.
The cType and vendor fields specify which of the currently installed effects will be used to decompress this sample. The cType field holds the name of the effect component to be used. The vendor field should contain the code for the supplier of the effect component you want to use. Because no central registry of effect names exists, suppliers could use the same effect code to identify their effect components; using the vendor field allows you to make sure that the right component is selected.
In the example in Listing 8 , the film noise (' fmns ') effect from Apple (' appl ') has been chosen.
If the specified effect component is not available when the sample is decompressed (i.e., when the movie containing the effect track is run) an error will occur.
| Previous | Chapter Contents | Chapter Top | Next |